package service.credit.impl;

import java.util.List;

import dao.ApplycustomrelationDao;
import exception.Exceptions;
import model.credit.Applycustomrelation;
import service.credit.ApplyCustomRelationInsertService;

public class ApplyCustomRelationInsertServiceImpl implements ApplyCustomRelationInsertService{
	private ApplycustomrelationDao applycustomrelationDao;

	@Override
	public Applycustomrelation save(Applycustomrelation applycustomrelation) throws Exceptions{
		try {
			return this.applycustomrelationDao.save(applycustomrelation);
		} catch (Exception e) {
			throw new Exceptions("在执行插入抵质押信息的过程中，出现了一个问题，请检查你的申请信息!");
		}
	}

	public ApplycustomrelationDao getApplycustomrelationDao() {
		return applycustomrelationDao;
	}

	public void setApplycustomrelationDao(
			ApplycustomrelationDao applycustomrelationDao) {
		this.applycustomrelationDao = applycustomrelationDao;
	}

	@Override
	public void delete(Integer applyid) throws Exceptions {
		List<Applycustomrelation> lists = this.applycustomrelationDao.findList("applyid", applyid);
		if(lists != null){
			for(Applycustomrelation applycustomrelation : lists){
				this.applycustomrelationDao.delete(applycustomrelation);
			}
		}
	}
	
	

}
